﻿using Prism.Ioc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Company.Communication.Serial
{
    public class CompanySerialModdule : IModule
    {
        public void OnInitialized(IContainerProvider containerProvider)
        {
            // 定义要传递的参数
            //var serialParameter = new (Type Type, object Instance)[]
            //{
            //        (typeof(string), "COM1"),
            //        (typeof(int), 9600)
            //};
            //var SerialTest = containerProvider.Resolve(typeof(ISerialCommunication), parameters: serialParameter) as ISerialCommunication;
            //SerialTest.OpenPort();
            //SerialTest.SendData("123");
            //SerialTest.ClosePort();
        }

        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.Register<ISerialCommunication, SerialCommunication>();
        }
    }
}
